Skip to content

fix: apply column_tags when updating a view via ALTER#1526

Open
sd-db wants to merge 3 commits into
mainfrom
sd-db/fix/view-alter-column-tags
Open

fix: apply column_tags when updating a view via ALTER#1526
sd-db wants to merge 3 commits into
mainfrom
sd-db/fix/view-alter-column-tags

Conversation

@sd-db

@sd-db sd-db commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes #1525.

A Unity Catalog view configured with view_update_via_alter: true and column-level databricks_tags failed on a subsequent dbt run whose only change was its column tags, erroring with Runtime Error … main is not being called during running model.

databricks__alter_view handled tags/tblproperties/query/column_comments from the configuration changeset but had no column_tags branch — while ViewConfig.config_components includes ColumnTagsProcessor and a column-tags-only change does not set requires_full_refresh, so it routes to alter_view rather than a full replace. With column tags as the only change, the macro became a no-op that never called statement('main').

This adds the column_tags branch to databricks__alter_view (mirroring the table/incremental paths), so the changed tags are applied on the alter path, matching the view create path.

Testing

  • TestColumnTagsViewUpdateViaAlter (functional): a V2 view with view_update_via_alter: true whose only second-run change is its column tags now applies them, asserted via system.information_schema.column_tags. Errored before the fix, passes after.
  • test_macros__alter_view_with_column_tags (unit): alter_view calls apply_column_tags when the changeset carries a column_tags entry, and not otherwise.

@sd-db sd-db requested a review from jprakash-db as a code owner June 16, 2026 10:05
A V2 view with view_update_via_alter: true errored with "main is not
being called during running model" on a run whose only change was its
column tags: databricks__alter_view had no column_tags branch, so the
alter macro became a no-op that never called statement('main'). Add the
branch so the changed column tags are applied on the alter path, matching
the view create path and the table/incremental paths.

Closes #1525
@sd-db sd-db force-pushed the sd-db/fix/view-alter-column-tags branch from 99d88c1 to cb9c5ec Compare June 16, 2026 10:05
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks
  impl.py 1446-1447
Project Total  

This report was generated by python-coverage-comment-action

@sd-db

sd-db commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

/integration-test

@github-actions

Copy link
Copy Markdown

Integration tests dispatched for PR #1526 by @sd-db. Track progress in the Actions tab.

@github-actions

Copy link
Copy Markdown

Integration results for PR #1526 — UC cluster ❌ failure · SQL warehouse ❌ failure · All-purpose cluster ✅ success · Shard coverage ✅ success

Run details.

@sd-db

sd-db commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

/integration-test

@github-actions

Copy link
Copy Markdown

Integration tests dispatched for PR #1526 by @sd-db. Track progress in the Actions tab.

@github-actions

Copy link
Copy Markdown

Integration results for PR #1526 — UC cluster ✅ success · SQL warehouse ✅ success · All-purpose cluster ✅ success · Shard coverage ✅ success

Run details.

ViewAPI._describe_relation now loads server column tags so view_update_via_alter runs no-op once tags match, with unit and functional test coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

View column tags not applied on the ALTER update path (view_update_via_alter: true) → "main is not being called" error

2 participants